
import re
import os

def search_path(root, mm, n=0):
    out = []
    if isinstance(mm, str):
        mm = mm.split('/')
    if n >= len(mm):
        out.append(root)
        return out
    if not os.path.isdir(root):
        print('错误：{}'.format("路径非文件夹  "), root)
        return []
    try:
        for file in os.listdir(root):
            if re.fullmatch(mm[n], file):
                f = os.path.join(root, file)
                if os.path.isdir(f):
                    out += search_path(f, mm, n+1)
    except:
        pass
    return out

